import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [{
  path: '/',
  redirect: '/login'
}, {
  path: '/login',
  name: 'Login',
  component: () => import('../views/Login.vue')
}, {
  path: '/home',
  name: 'Home',
  component: () => import('../views/Home.vue'),
  children: [{
    path: "/main",
    name: "Main",
    meta: {
      title: '首页'
    },
    component: () => import("../views/Main.vue")
  }, {
    path: "/error404",
    name: "404",
    meta: {
      title: '404'
    },
    component: () => import("../views/404.vue")
  }, {
    path: "/error500",
    name: "403",
    meta: {
      title: '500'
    },
    component: () => import("../views/500.vue")
  },
    <#if routerParams??>
      <#list routerParams as col>
 {
        path: "/${col["routerName"]}",
        name: "${col["chinaName"]}",
        meta: {
        title: '${col["chinaName"]}'
        },
        component: () => import("../views/${col["routerName"]}.vue")
 } ,

  </#list>
  </#if>
  ]
},

]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  // base: "manage",
  routes
})

export default router
